package com.ruoyi.flowable.listener;

import com.ruoyi.flowable.config.SpringContextHolder;
import com.ruoyi.members.domain.SysMembers;
import com.ruoyi.members.service.ISysMembersService;
import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;
import org.springframework.stereotype.Component;

/**
 * @author cy
 */
@Component
public class MembersTaskListener implements TaskListener {
    @Override
    public void notify(DelegateTask delegateTask) {

        SysMembers sysMembers = (SysMembers) delegateTask.getVariable("commonClass");
        sysMembers.setMembersIsStatus("0");
        // 修改  members的service
        // 从Spring容器中获取的bean，bean的名称是首字母小写
        ISysMembersService sysMembersService = SpringContextHolder.getBean("sysMembersServiceImpl", ISysMembersService.class);
        sysMembersService.updateById(sysMembers);
        // 角色  role的service

    }
}
